package cn.wp.common.core.startup;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Console;
import cn.wp.common.core.Wp;

import java.util.Set;

/**
 * 启动配置类容器
 * Created by chenyb on 2019/10/23
 */
public class StartupContainer {

    private Set<Startup> startupSet = CollectionUtil.newHashSet();

    // 添加启动器
    public void addStartup(Startup startup){
        startupSet.add(startup);
    }

    // 启动
    public void startAll(Wp wp){
        for(Startup startup : startupSet){
            startup.start(wp);
            Console.log("-- Startup " + startup.getClass().getName() + " start success");
        }
    }

}
